import App from "./App.vue";
import router from "./router";
import store from "./store";
import animate from "./animate";
import "./permission";
import ArcoVueIcon from "@arco-design/web-vue/es/icon";
import {
  Alert,
  Badge,
  Card,
  ColorPicker,
  Divider,
  Drawer,
  FormItem,
  Layout,
  Menu,
  Modal,
  Pagination,
  Popconfirm,
  Scrollbar,
  Space,
  Table,
  Tabs,
  Transfer,
  TreeSelect
} from "@arco-design/web-vue";
import "@arco-design/web-vue/es/transfer/style/index.less";
import "@arco-design/web-vue/es/tabs/style/index.less";
import "@arco-design/web-vue/es/alert/style/index.less";
import "@arco-design/web-vue/es/tree-select/style/index.less";
import "@arco-design/web-vue/es/drawer/style/index.less";
import "@arco-design/web-vue/es/card/style/index.less";
import "@arco-design/web-vue/es/popconfirm/style/index.less";
import "@arco-design/web-vue/es/table/style/index.less";
import "@arco-design/web-vue/es/pagination/style/index.less";
import "@arco-design/web-vue/es/divider/style/index.less";
import "@arco-design/web-vue/es/message/style/index.less";
import "@arco-design/web-vue/es/notification/style/index.less";
import "@arco-design/web-vue/es/modal/style/index.less";
import "@arco-design/web-vue/es/badge/style/index.less";

import plugins from "./plugins/index";
import directive from "./directive";
import { useDict } from "@/utils/dict";
import { handleTree } from "@/utils/asiainfo";
import formCreate from "@form-create/arco-design";
import install from "@form-create/arco-design/auto-import";
import FcDesigner from "arco-design-designer";
// 自定义样式
import "@/assets/styles/global.less";

formCreate.use(install);

import dayjs from "dayjs";
import zhCn from "dayjs/locale/zh-cn";
import relativeTime from "dayjs/plugin/relativeTime";
dayjs.locale(zhCn);
dayjs.extend(relativeTime);

// 默认点击遮照为不关闭
Modal.props.maskClosable.default = false;
Modal.props.titleAlign.default = "start";
Modal.props.alignCenter.default = false;
Modal.props.top.default = "10%";
Modal.props.unmountOnClose.default = true;
Modal.props.escToClose.default = false;
Drawer.props.maskClosable.default = false;
Drawer.props.escToClose.default = false;
Drawer.props.unmountOnClose.default = true;
Scrollbar.props.type.default = "embed";
FormItem.props.asteriskPosition.default = "end";

const app = createApp(App);

app.config.globalProperties.animate = animate;
app.config.globalProperties.useDict = useDict;
app.config.globalProperties.handleTree = handleTree;

app
  .use(Space)
  .use(Table)
  .use(Badge)
  .use(Menu)
  .use(Pagination)
  .use(Card)
  .use(Drawer)
  .use(Layout)
  .use(Popconfirm)
  .use(TreeSelect)
  .use(Tabs)
  .use(ColorPicker)
  .use(Divider)
  .use(Transfer)
  .use(Alert)
  .use(formCreate)
  .use(FcDesigner)
  .use(router)
  .use(store)
  .use(ArcoVueIcon)
  .use(plugins);

// 自定义指令
directive(app);

app.mount("#app");
